package com.lungle.warmdiary.app.view.wallet.adapter;

import android.text.Html;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lungle.warmdiary.R;
import com.lungle.warmdiary.app.base.ListBaseAdapter;
import com.lungle.warmdiary.app.model.response.WithdrawRecoder;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by God on 2016/8/8.
 */
public class WithdrawRecordAdapter extends ListBaseAdapter {

    @Override
    protected View getRealView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        if (convertView == null || convertView.getTag() == null) {
            convertView = getLayoutInflater(parent.getContext()).inflate(
                    R.layout.list_cell_wallet_record, null);
            vh = new ViewHolder(convertView);
            convertView.setTag(vh);
        } else {
            vh = (ViewHolder) convertView.getTag();
        }

        WithdrawRecoder item = (WithdrawRecoder) mDatas.get(position);
        vh.mTvTradeSum.setText(Html.fromHtml("<font color=#008000>-" + item.getAmount() + "</font><font color=#333333>元</font>"));
        vh.mTvTradeTime.setText(item.getCreatetime());
        return convertView;
    }


    class ViewHolder {
        @Bind(R.id.tv_trade_time)
        TextView mTvTradeTime;
        @Bind(R.id.tv_trade_sum)
        TextView mTvTradeSum;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
